<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML" 4.01"//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Created: August 17, 2001-->
<!--
$Id: RepSurvMachine.php,v 1.5 2001/11/02 19:09:14 eugenem Exp $
$Header: /export/home/eugenem/public_html/ComplianceReports/RCS/RepSurvMachine.php,v 1.5 2001/11/02 19:09:14 eugenem Exp $
$Log: RepSurvMachine.php,v $
Revision 1.5  2001/11/02 19:09:14  eugenem
Moved HTTP_*_VARS processing to dbc.inc

Revision 1.4  2001/11/02 14:59:48  eugenem
Moved database connect statements to a separate file.

Revision 1.3  2001/10/23 20:38:54  eugenem
Made SurveyID column a link to ResolveRecommendations.php so that recommendations for that survey can be viewed.

Revision 1.2  2001/10/23 17:49:19  eugenem
<form action> was pointing to the wrong form after being renamed.  Fixed.

Revision 1.1  2001/10/22 19:35:33  eugenem
Initial revision

Revision 1.2  2001/10/22 19:15:17  eugenem
Display Notes field in the report along with the machine description.

Revision 1.1  2001/08/17 16:18:46  eugenem
Initial revision

-->

<html>
<head>
<title>Radiological Equipment Database</title>
<meta name="author" content="Eugene Mah">
<link rev="made" href="mailto:eugenem@ix.netcom.com">
<link rev="home" href="http://home.netcom.com/~eugenem/">
<meta name="description" content="">
<meta name="Keywords" content="">
<meta name="Reply-to" content="eugenem@ix.netcom.com">
<META http-equiv="PICS-Label" content='(PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~0001))'>
<?PHP
require('functions.inc');
require('dbc.inc');

?>
</head>

<body>
<h1>Radiological Equipment Database</h1>
<h2>List Surveys by Machine</h2>
<?PHP
if (isset($MachID)) {
  while (list($name,$id) = each($MachID)) {
    $row = mysql_fetch_array(mysql_query("select Description,Notes from Machines where MachineID=$id"));
    $desc = $row['Description'];
    $note = $row['Notes'];

    $query = "SELECT Survey2Machine.SurveyID,TestDate,TestType,Accession
	          FROM TestDates 
			  LEFT JOIN Survey2Machine USING (SurveyID)
			  LEFT JOIN Machines ON Survey2Machine.MachineID = Machines.MachineID
			  LEFT JOIN Location USING (LocationID),TestType
			  WHERE Survey2Machine.MachineID = $id
			  AND TestType.TypeID = TestDates.TypeID
			  AND Status=\"Active\"
			  ORDER BY SurveyID";
    //$query = "SELECT SurveyID,TestDate,TestType,Accession FROM ";
    //$query .= "Location,Machines,TestDates,TestType WHERE ";
    //$query .= "TestDates.MachineID=$id ";
    //$query .= "AND Active=1 AND ";
    //$query .= "Location.LocationID=Machines.LocationID AND ";
    //$query .= "TestDates.MachineID=Machines.MachineID AND ";
    //$query .= "TestType.TypeID=TestDates.TypeID ";
    //$query .= "ORDER BY Description,SurveyID";

    $result = mysql_query($query)
      or die ("Query failed: $query<br>\n");
?>
<h2><?PHP echo $desc . " (" . $note . ")"; ?></h2>
<table border=1>
  <tr>
    <th>SurveyID</th><th>TestDate</th><th>TestType</th><th>Accession</th>
  </tr>
<?PHP
  // Spit the results out into a table
    while ($row = mysql_fetch_array($result)) {
      echo "<tr>\n";
      echo "<td><a href=\"SurveyResRec.php?SurveyID=";
      echo $row['SurveyID'];
      echo "\">" . $row['SurveyID'] . "</a></td>\n";
      echo "<td>" . $row['TestDate'] . "</td>\n";
      echo "<td>" . $row['TestType'] . "</td>\n";
      echo "<td>" . $row['Accession'] . "</td>\n";
      echo "<tr>\n";
    }
?>
</table>
<?PHP
  }
}
?>
<form action="RepSurvMachine.php" method="POST">
<p>Select machine:
<select name="MachID[]" size=4 MULTIPLE>
<?PHP
$machine = mysql_query("select MachineID,Description from Machines where Status=\"Active\" order by Description");
while (list($key,$val) = mysql_fetch_array($machine)) {
  echo "<option value=\"$key\">$val</option>\n";
}
?>
</select>
(Control or Shift click to select multiple machines)
</p>
<p><input type="SUBMIT" value="Search"> / <input type="RESET" value="Reset"> / <a href="index.html" target="_top" >Main</a></p>
</form>
</body>
</html>
